//
//  JPDHomeController.m
//  JwPackDemo
//
//  Created by 陈警卫 on 2025/8/13.
//

#import "JPDHomeController.h"
#import "FBtManager.h"

@interface JPDHomeController ()

@end

@implementation JPDHomeController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setupView];
    [self setupData];
}

- (void)setupData {
    [FBtManager shared];
}


- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
}

- (void)setupView {
    kJwWeak(self);
    
    UIButton *btn1 = [UIButton buttonWithType:(UIButtonTypeCustom)];
    btn1.frame = CGRectMake(20, 100, 100, 30);
    [btn1 setTitle:@"连接1" forState:(UIControlStateNormal)];
    [btn1 setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)];
    btn1.backgroundColor = [UIColor yellowColor];
    [self.view addSubview:btn1];
    [btn1 jw_addTargetAction:^(UIButton *button) {
        [[FBtManager shared] autoNotifyWithName:@"MI_60M4102LGYYY001"];
    }];
    
    UIButton *btn2 = [UIButton buttonWithType:(UIButtonTypeCustom)];
    btn2.frame = CGRectMake(20, 140, 100, 30);
    [btn2 setTitle:@"连接2" forState:(UIControlStateNormal)];
    [btn2 setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)];
    btn2.backgroundColor = [UIColor yellowColor];
    [self.view addSubview:btn2];

    [btn2 jw_addTargetAction:^(UIButton *button) {
        [[FBtManager shared] autoNotifyWithName:@"MI_60M1601LGYYY001"];
    }];
    
    UIButton *btn3 = [UIButton buttonWithType:(UIButtonTypeCustom)];
    btn3.frame = CGRectMake(20, btn2.jw_bottom + 10, 100, 30);
    [btn3 setTitle:@"发送数据" forState:(UIControlStateNormal)];
    [btn3 setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)];
    btn3.backgroundColor = [UIColor yellowColor];
    [self.view addSubview:btn3];

    [btn3 jw_addTargetAction:^(UIButton *button) {
        
        FBtMessageModel *messageModel = [FBtMessageModel modelWithSignal:(0xFFFF)];
        [messageModel send].didReceiveAction = ^(FBtMessageModel *messageModel) {
            
            NSLog(@"didReceiveAction--%@", messageModel);
        };
    }];
}


@end
